package com.qst.crop.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qst.crop.dao.CartDao;
import com.qst.crop.dao.OrderDao;
import com.qst.crop.entity.Cart;
import com.qst.crop.entity.MyCart;
import com.qst.crop.entity.Order;
import com.qst.crop.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class CartServiceImpl implements CartService {
    @Autowired
    CartDao cartDao;


    @Override
    public int add(Cart cart) {

        return cartDao.add(cart);
    }

    @Override
    public int update(Integer shoppingId, Integer count) {
        LocalDateTime upTime = LocalDateTime.now();
        return cartDao.update(shoppingId,count,upTime);
    }

    @Override
    public int delete(int id) {
        return cartDao.delete(id);
    }

    @Override
    public List<Cart> show() {

        return cartDao.show();
    }

    @Override
    public List<MyCart> show1(String username){
        return cartDao.show1(username);
    }

    @Override
    public int isExit(Integer id,String username){
        return cartDao.isExit(id,username);
    }
}
